﻿using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Bilibili.Model.Live;
using System;

namespace Avalonia.BiliBili.Libs.Models
{
    public sealed class GuardRankItem : GuardRankListModel
    {
        public GuardRankItem(GuardRankListModel item)
        {
            this.Uid = item.Uid;
            this.Face = item.Face;
            this.Ruid = item.Ruid;
            this.Rank = item.Rank;
            this.Is_Alive = item.Is_Alive;
            this.UserName = item.UserName;
            this.Guard_Level = item.Guard_Level;
        }
        public IImage Guard_Icon
        {
            get
            {
                var uri = Guard_Level switch
                {
                    1 => new Uri("avares://Avalonia.BiliBili/Assets/Live/ic_live_guard_1.png"),
                    2 => new Uri("avares://Avalonia.BiliBili/Assets/Live/ic_live_guard_2.png"),
                    _ => new Uri("avares://Avalonia.BiliBili/Assets/Live/ic_live_guard_3.png")
                };
                return new Bitmap(AssetLoader.Open(uri));
            }
        }
    }
}